<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width" />
    <title id="window-title">文章阅读</title>
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="layui/css/layui.css" />
    <link rel="stylesheet" href="css/master.css" />
    <link rel="stylesheet" href="css/gloable.css" />
    <link rel="stylesheet" href="css/nprogress.css" />
    <link rel="stylesheet" href="css/blog.css" />
    <link rel="stylesheet" href="css/message.css" />
</head>
<body>
    <div class="header">
    </div>
    <header class="gird-header">
        <div class="header-fixed">
            <div class="header-inner">
                <a href="javascript:void(0)" class="header-logo" id="logo">Mr.Yss</a>
                <nav class="nav" id="nav">
                    <ul>
                        <li><a href="index.html">首页</a></li>
                        <li><a href="articleIndex.html">博客</a></li>
                        <li><a href="message.html">留言</a></li>
                        <li><a href="link.html">友链</a></li>
                    </ul>
                </nav>
                <a href="#" class="blog-user">
                    <i class="fa fa-qq"></i>
                </a>
                <a class="phone-menu">
                    <i></i>
                    <i></i>
                    <i></i>
                </a>
            </div>
        </div>
    </header>
    <div class="doc-container" id="doc-container">
        <div class="container-fixed">
            <div class="col-content" style="width:100%">
                <div class="inner">
                    <article class="article-list">
                        <input type="hidden" value="@Model.BlogTypeID" id="blogtypeid" />
                        <section class="article-item">
                            <aside class="title" id="title" style="line-height:1.5;">

                            </aside>
                            <div class="content artiledetail" style="border-bottom: 1px solid #e1e2e0; padding-bottom: 20px;">
                                <div  id="articleContent">

                                </div>
                            </div>
                        </section>
                    </article>
                </div>
            </div>
            <div class="f-cb"></div>
            <div class="container-inner">
                <section class="msg-remark">
                    <h1>评论区</h1>
                    <p>
                        沟通交流，拉近你我！
                    </p>
                </section>
                <div class="textarea-wrap message" id="textarea-wrap">
                    <form class="layui-form blog-editor" action="">
                        <div class="layui-form-item">
                            <textarea name="editorContent" lay-verify="content" id="remarkEditor" placeholder="请输入内容" class="layui-textarea layui-hide"></textarea>
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn" lay-submit="formLeaveMessage" lay-filter="formLeaveMessage">提交评论</button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="mt20">
                <ul class="message-list" id="message-list">
                    <li class="zoomIn article">
                        <div class="comment-parent">
                            <a name="remark-1"></a>
                            <img src="https://thirdqq.qlogo.cn/qqapp/101465933/7627F745B95BFAC18C6C481FE72B4EB1/100" />
                            <div class="info">
                                <span class="username">燕十三</span>
                            </div>
                            <div class="comment-content">
                                剑气纵横三万里
                            </div>
                            <p class="info info-footer">
                                <i class="fa fa-map-marker" aria-hidden="true"></i>
                                <span>四川</span>
                                <span class="comment-time">2018-01-01</span>
                                <a href="javascript:;" class="btn-reply" data-targetid="1" data-targetname="燕十三">回复</a>
                            </p>
                        </div>
                        <hr />
                        <div class="comment-child">
                            <a name="reply-1"></a>
                            <img src="https://thirdqq.qlogo.cn/qqapp/101465933/7627F745B95BFAC18C6C481FE72B4EB1/100">
                            <div class="info">
                                <span class="username">燕十四</span>
                                <span style="padding-right:0;margin-left:-5px;">回复</span>
                                <span class="username">燕十三</span>
                                <span>一剑光寒十九洲</span>
                            </div>
                            <p class="info">
                                <i class="fa fa-map-marker" aria-hidden="true"></i>
                                <span>四川</span>
                                <span class="comment-time">2018-01-01</span>
                                <a href="javascript:;" class="btn-reply" data-targetid="2" data-targetname="燕十四">回复</a>
                            </p>
                        </div>
                        <div class="replycontainer layui-hide">
                            <form class="layui-form" action="">
                                <input type="hidden" name="remarkId" value="1">
                                <input type="hidden" name="targetUserId" value="0">
                                <div class="layui-form-item">
                                    <textarea name="replyContent" lay-verify="replyContent" placeholder="请输入回复内容" class="layui-textarea" style="min-height:80px;"></textarea>
                                </div>
                                <div class="layui-form-item">
                                    <button class="layui-btn layui-btn-xs" lay-submit="formReply" lay-filter="formReply">提交</button>
                                </div>
                            </form>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <footer class="grid-footer">
        <div class="footer-fixed">
            <div class="copyright">
                <div class="info">
                    <div class="contact">
                        <a href="javascript:void(0)" class="github" target="_blank"><i class="fa fa-github"></i></a>
                        <a href="#" class="qq" target="_blank" ><i class="fa fa-qq"></i></a>
                        <a href="#" class="email" target="_blank" ><i class="fa fa-envelope"></i></a>
                        <a href="javascript:void(0)" class="weixin"><i class="fa fa-weixin"></i></a>
                    </div>
                    <p class="mt05">
                        Copyright &copy; 2018-2018 燕十三 All Rights Reserved V.3.1.3 蜀ICP备18008600号
                    </p>
                </div>
            </div>
        </div>
    </footer>
    <script src="layui/layui.js"></script>
    <script src="js/yss/gloable.js"></script>
    <script src="js/plugins/nprogress.js"></script>
    <script src="js/pagemessage.js"></script>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/dateUtils.js"></script>
    <script>NProgress.start();</script>
    <script>
        window.onload = function () {
            NProgress.done();
        };
    </script>
    <script>
        function getUrlParams(name) { // 不传name返回所有值，否则返回对应值
            var url = window.location.search;
            if (url.indexOf('?') == 1) { return false; }
            url = url.substr(1);
            url = url.split('&');
            var name = name || '';
            var nameres;
            // 获取全部参数及其值
            for(var i=0;i<url.length;i++) {
                var info = url[i].split('=');
                var obj = {};
                obj[info[0]] = decodeURI(info[1]);
                url[i] = obj;
            }
            // 如果传入一个参数名称，就匹配其值
            if (name) {
                for(var i=0;i<url.length;i++) {
                    for (const key in url[i]) {
                        if (key == name) {
                            nameres = url[i][key];
                        }
                    }
                }
            } else {
                nameres = url;
            }
            // 返回结果
            return nameres;
        }

        var article=JSON.parse($.ajax({
            url:"http://back.caidabao.website/article/findById/"+getUrlParams('id'),
            async: false,
            type:"GET"
        }).responseText);

        $.ajax({
            url:"http://back.caidabao.website/article/articleViewTimes/"+getUrlParams('id'),
            async: false,
            type:"PUT"
        });

        var articleViewTimes=JSON.parse($.ajax({
            url:"http://back.caidabao.website/article/articleViewTimes/"+getUrlParams('id'),
            async: false,
            type:"GET"
        }).responseText);

        //html title自定义
        $("#window-title").html(article.articleTitle);

        var date=new Date(article.createTime);

        var thisArticlTitle='';
        thisArticlTitle+=' <h4>'+article.articleTitle+'</h4>\n' +
            '                                <p class="fc-grey fs-14">\n' +
            '                                    <small>\n' +
            '                                        作者：<a href="javascript:void(0)" target="_blank" class="fc-link">蔡大宝 </a>\n' +
            '                                    </small>\n' +
            '                                    <small class="ml10">阅读量<i class="readcount">'+articleViewTimes+'</i></small>\n' +
            '                                    <small class="ml10">更新于 <label>'+dateUtils(date)+'</label> </small>\n' +
            '                                </p>';
        $("#title").html(thisArticlTitle);


        var year=date.getFullYear();
        var month=date.getMonth()+1;
        var day=date.getDate();
        var dateWindow='';
        dateWindow+='<span class="day">'+day+'</span>\n' +
            '        <span class="month fs-18">'+month+'<small class="fs-14">月</small></span>\n' +
            '        <span class="year fs-18">'+year+'</span>'

        $("#dateWindow").html(dateWindow);

        var thisArticleContent='';
        thisArticleContent+=article.articleContent;
        $("#articleContent").html(thisArticleContent);

    </script>


</body>
</html>
